export default ({ app: { router }, store }) => {
    router.afterEach((to, from) => {
        if(window.sessionStorage.breadcrumbs){
            store.state.breadcrumbs = JSON.parse(window.sessionStorage.breadcrumbs)
        }
            var i = to.fullPath
            if(i == "/"){
                store.commit("changeBreadcrumbs",{data:[{name:"首页",url:"/"}],type:0})
            }
            if(i == "/equity"){
                store.commit("changeBreadcrumbs",{data:[{name:"首页",url:"/"},{name:"私募股权",url:"/about"}],type:0})
            }
            if(i == "/trust"){
               store.commit("changeBreadcrumbs",{data:[{name:"首页",url:"/"},{name:"信托资管",url:"/trust"}],type:0})
            }
            if(i == "/fund"){
                store.commit("changeBreadcrumbs",{data:[{name:"首页",url:"/"},{name:"契约基金",url:"/fund"}],type:0})
            }
            if(i == "/research"){
                store.commit("changeBreadcrumbs",{data: [{name:"首页",url:"/"},{name:"天沁投研",url:"/research"}],type:0})
            }
            if(i == "/advisory"){
                store.commit("changeBreadcrumbs",{data: [{name:"首页",url:"/"},{name:"热点资讯",url:"/advisory"}],type:0})
            }
            if(i == "/about"){
                store.commit("changeBreadcrumbs",{data:[{name:"首页",url:"/"},{name:"关于我们",url:"/about"}],type:0})
            }
            if(i == "/newsall"){
                store.commit("changeBreadcrumbs",{data: [{name:"首页",url:"/"},{name:"新闻列表",url:"/newsall"}],type:0})
            }
            if(i == "/insurance"){
               store.commit("changeBreadcrumbs",{data: [{name:"首页",url:"/"},{name:"海外保险",url:"/insurance"}],type:0})
            }
            if(i == "/house"){
               store.commit("changeBreadcrumbs",{data: [{name:"首页",url:"/"},{name:"海外房产",url:"/house"}],type:0})
            }
            if(i == "/news/dailynews"){
                store.commit("changeBreadcrumbs",{data: [{name:"首页",url:"/"},{name:"每日财讯",url:"/news/dailynews"}],type:0})
             }
            if(i.indexOf("newslist") != -1){
                if(store.state.breadcrumbs.length == 3){
                    store.commit("breadcrumbspop")
                }      
       
                store.commit("changeBreadcrumbs",{data: {name:"新闻列表",url:i},type:1})
            }
            if(i.indexOf("product") != -1){
                if(store.state.breadcrumbs.length == 3){
                    store.commit("breadcrumbspop")
                }
                store.commit("changeBreadcrumbs",{data: {name:"产品详情",url:i},type:1})
            }
            if(i.indexOf("post") != -1 || i.indexOf("school") != -1 || i.indexOf("web") != -1 ){
                if(store.state.breadcrumbs.length == 3){
                  store.commit("breadcrumbspop")
                }      
                store.commit("changeBreadcrumbs",{data: {name:"正文",url:i},type:1})
            }
            if((i.indexOf("post") != -1 || i.indexOf("school") != -1 || i.indexOf("web") != -1 ) && i.indexOf("newslist") != -1){
                if( store.state.breadcrumbs.length == 4){
                   store.commit("breadcrumbspop")
                }      
                store.commit("changeBreadcrumbs",{data: {name:"正文",url:i},type:1})
            }
            if(i.indexOf("/search") != -1){
                if( store.state.breadcrumbs.length == 3){
                     store.commit("breadcrumbspop")
                }      
                 store.commit("changeBreadcrumbs",{data: {name:"搜索详情",url:i},type:1})
            }
            if(i.indexOf("/column") != -1){
                if( store.state.breadcrumbs.length == 3){
                     store.commit("breadcrumbspop")
                } 
                 store.commit("changeBreadcrumbs",{data: {name:"新闻列表",url:i},type:1})     
            }
            if(i.indexOf("/gonggao") != -1){
                 store.commit("changeBreadcrumbs",{data: [{name:"首页",url:"/"},{name:"产品公告",url:i}],type:0})
            }
            if(i != "/house" && i.indexOf("/house") != -1){
                if( store.state.breadcrumbs.length == 3){
                     store.commit("breadcrumbspop")
                }      
                 store.commit("changeBreadcrumbs",{data: {name:"产品详情",url:i},type:1})
            }
            if(i != "/insurance" && i.indexOf("/insurance") != -1){
                if( store.state.breadcrumbs.length == 3){
                     store.commit("breadcrumbspop")
                }      
                 store.commit("changeBreadcrumbs",{data: {name:"产品详情",url:i},type:1})
            }
        })
}